package com.xiaolin.lang;


/**
 * @ClassName TestBoolean
 * @Description 测试boolean包装类
 * @Detail detail
 * @Author MyPC
 * @Date 2020/10/17
 * @Version 1.0
 */
public class TestBoolean {
    public static void main(String[] args) {
        //创建Boolean对象
        Boolean aTrue = new Boolean("true");
        Boolean aa = new Boolean("aa");
        Boolean aFalse = new Boolean("false");
        Boolean aBoolean = new Boolean(true);
        System.out.println(aTrue);
        System.out.println(aa);
        System.out.println(aFalse);
        System.out.println(aBoolean);
        Boolean aa1 = Boolean.valueOf("true");
        System.out.println(aa1);
        System.out.println(Boolean.FALSE);
        System.out.println(Boolean.TRUE);
        //获取包装类的基本类型
        System.out.println("class==="+Boolean.TYPE);
        //自动装箱
        Boolean b=true;
        //自动拆箱
        boolean c=Boolean.TRUE;
        //比较值
        System.out.println(Boolean.compare(false,true));
        System.out.println(aa1.compareTo(aFalse));
        System.out.println(aa1.equals(aFalse));
        //获取hashCode
        System.out.println(aa1.hashCode());
        System.out.println(Boolean.hashCode(true));
        //逻辑运算
        System.out.println(Boolean.logicalAnd(true,true));
        System.out.println(Boolean.logicalOr(true,false));
        System.out.println(Boolean.logicalXor(true,true));
        //转成字符串
        System.out.println(aa1.toString());
        System.out.println(Boolean.toString(true));
    }
}
